﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using LibFriesland_Campina_CRM;

namespace WebServiceFriesland_Campina_CRM
{
    /// <summary>
    /// Summary description for FCAccountWS
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    public class FCAccountWS : System.Web.Services.WebService
    {
        [WebMethod]
        //Lay danh sach Account
        public List<BizAccount> getAll()
        {
            return BizAccount.getAll();
        }

        [WebMethod]
        //Them mot Account moi
        public int addAccount(string pUsername, string pPassword, string pId, string pBy_privilege, bool pDisabled)
        {
            BizAccount account = new BizAccount(pUsername, pPassword, pId, pBy_privilege, pDisabled);
            return account.addAccount();
        }

        [WebMethod]
        //Cap nhat thong tin Account
        public int updateAccount(string pUsername, string pPassword, string pId, string pBy_privilege, bool pDisabled)
        {
            BizAccount account = new BizAccount(pUsername, pPassword, pId, pBy_privilege, pDisabled);
            return account.updateAccount();
        }

        [WebMethod]
        //Xoa thong tin Account
        public int deleteAccount(string pUsername)
        {
            return BizAccount.deleteAccount(pUsername);
        }

        [WebMethod]
        //Dang nhap
        public BizAccount Login(string pUsername, string pPassword)
        {
            BizAccount account = BizAccount.Login(pUsername, pPassword);
            return account;
        }

        [WebMethod]
        //Doi mat khau
        public int changePassword(string pUsername, string pOldPassword, string pNewPassword)
        {
            return BizAccount.changePassword(pUsername, pOldPassword, pNewPassword);
        }
    }
}
